package entry30.pre;

import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.*;

import org.junit.Test;

public class Calculator {
	public int cal(int x, int y, String op) {
		if(op.equals("+")) {
			return x + y;
		}else if(op.equals("-")) {
			return x - y;
		}else if(op.equals("*")) {
			return x * y;
		}else if(op.equals("/")) {
			return x/y;
		}

		throw new AssertionError();
	}
	
	@Test
	public void testCalcuator() {
		assertThat(cal(6, 3, "+"), is(9));
		assertThat(cal(6, 3, "-"), is(3));
		assertThat(cal(6, 3, "*"), is(18));
		assertThat(cal(6, 3, "/"), is(2));
	}
}
